package multiThreadTest.nucleicacidtest;

public class NucleicAcidDetectionPoint extends Thread{
    private int completeNum=0;
    private int queueSize=0;
    private int cycleTime=100;
    private int addMaxTime=100;

    public NucleicAcidDetectionPoint(int cycleTime,int addMaxTime) {
        this.cycleTime = cycleTime;
        this.addMaxTime=addMaxTime;
    }

    @Override
    public void run() {
        while (true){
            try {
                Thread.sleep(cycleTime+(int)(Math.random()*addMaxTime));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if(queueSize>0){
                queueSize--;
                completeNum++;
            }
        }
    }

    public int getCompleteNum() {
        return completeNum;
    }

    public void setCompleteNum(int completeNum) {
        this.completeNum = completeNum;
    }

    public int getQueueSize() {
        return queueSize;
    }

    public void setQueueSize(int queueSize) {
        this.queueSize = queueSize;
    }

    public void lengthenQueueSize(int n){
        this.queueSize+=n;
    }

    public int getCycleTime() {
        return cycleTime;
    }

    public void setCycleTime(int cycleTime) {
        this.cycleTime = cycleTime;
    }

}
